﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
namespace ZLDC.Common
{
    public class ConnectionString
    {
        public static string Get()
        {
            return Get(ConnectionType.OldZlhq);
        }

        public static string Get(ConnectionType CType)
        {
#if DEBUG //测试
            switch (CType)
            {
                case ConnectionType.NewZLhq:
                    return "server=192.168.10.181;database=zlhq_sz_new;user=kfb;pwd=kfb";
                case ConnectionType.OldZlhq:
                    return "server=192.168.10.181;database=zlhq_sz_old;user=kfb;pwd=kfb";
                case ConnectionType.Zllp:
                    return "server=192.168.10.181;database=lpglnew;user=sa;pwd=west5678";
                case ConnectionType.Zlnw:
                    return "server=192.168.168.80;database=zlhq;user=kfb;pwd=kfb168*)KFB";//kfb168*)KFB
                case ConnectionType.Zlsz:
                    return "server=192.168.168.80;database=zlhq;user=kfb;pwd=kfb168*)KFB";
                case ConnectionType.Zlcs:
                    return "server=192.168.10.181;database=zlhq_cs;user=kfb;pwd=kfb";
                case ConnectionType.Zlwh:
                    return "server=192.168.10.181;database=zlhq_wh;user=kfb;pwd=kfb";
                case ConnectionType.Zlgz:
                    return "server=192.168.10.181;database=zlhq_gz;user=kfb;pwd=kfb";
                case ConnectionType.ZLReport:
                    return "server=192.168.168.80;database=zlReport;user=kfb;pwd=kfb168*)KFB";
                case ConnectionType.ZLDCHR:
                    return ConfigurationSettings.AppSettings["ZLDCHR"].ToString();
                case ConnectionType.ZlAsset:
                    return "server=192.168.168.80;database=ZlAsset;user=sa;pwd=zldc168*)ZLDC";
                default:
                    return "server=192.168.10.181;database=zlhq;user=kfb;pwd=kfb";
            }
#else  //正式
           
                switch (CType)
                {
                    case ConnectionType.NewZLhq:
                        return "server=192.168.168.101;database=zlhq_sz_new;user=kfb;pwd=zldc1234zlhq";
                    case ConnectionType.OldZlhq:
                        return "server=192.168.168.101;database=zlhq_sz_old;user=kfb;pwd=zldc1234zlhq";
                    case ConnectionType.Zllp:
                        return "server=192.168.168.101;database=lpglnew;user=sa;pwd=west5678";
                    case ConnectionType.Zlnw:
                        return "server=192.168.168.101;database=zlhq;user=kfb;pwd=zldc1234zlhq";
                    case ConnectionType.Zlsz:
                        return "server=192.168.168.101;database=zlhq;user=kfb;pwd=zldc1234zlhq";
                    case ConnectionType.Zlcs:
                        return "server=192.168.168.101;database=zlhq_cs;user=kfb;pwd=value!@#&*(over";
                    case ConnectionType.Zlwh:
                        return "server=192.168.168.101;database=zlhq_wh;user=kfb;pwd=zldc1234zlhq";
                    case ConnectionType.Zlgz:
                        return "server=192.168.168.101;database=zlhq_gz;user=kfb;pwd=zldc1234zlhq";
                    case ConnectionType.ZLReport:
                        return "server=192.168.168.80;database=zlReport;user=kfb;pwd=kfb168*)KFB";
                    case ConnectionType.ZLDCHR:
                        return ConfigurationSettings.AppSettings["ZLDCHR"].ToString();
                    case ConnectionType.ZlAsset:
                        return "server=192.168.168.80;database=ZlAsset;user=sa;pwd=zldc168*)ZLDC";
                    default:
                        return "server=192.168.168.101;database=zlhq;user=kfb;pwd=value!@#&*(over";
                }
#endif
        }

        /// <summary>
        /// 新数据库
        /// </summary>
        public static string NewZlhq
        {
            get { return Get(ConnectionType.NewZLhq); }
        }

        /// <summary>
        /// 楼盘数据库
        /// </summary>
        public static string Zllp
        {
            get { return Get(ConnectionType.Zllp); }
        }

        /// <summary>
        /// 旧数据库
        /// </summary>
        public static string OldZllp
        {
            get { return Get(ConnectionType.OldZlhq); }
        }

        /// <summary>
        /// 深圳数据库
        /// </summary>
        public static string Zlsz
        {
            get { return Get(ConnectionType.Zlsz); }
        }

        /// <summary>
        /// 长沙数据库
        /// </summary>
        public static string Zlcs
        {
            get { return Get(ConnectionType.Zlcs); }
        }

        /// <summary>
        /// 武汉数据库
        /// </summary>
        public static string Zlwh
        {
            get { return Get(ConnectionType.Zlwh); }
        }

        /// <summary>
        /// 广州数据库
        /// </summary>
        public static string Zlgz
        {
            get { return Get(ConnectionType.Zlgz); }
        }

        /// <summary>
        /// 报表数据库
        /// </summary>
        public static string ZLReport
        {
            get { return Get(ConnectionType.ZLReport); }
        }

        /// <summary>
        /// 金蝶数据库
        /// </summary>
        public static string ZLDCHR
        {
            get { return Get(ConnectionType.ZLDCHR); }
        }

        /// <summary>
        /// 行政资产数据库
        /// </summary>
        public static string ZlAsset
        {

            get { return Get(ConnectionType.ZlAsset); }
        }

    }

    public enum ConnectionType
    {
        /// <summary>
        /// 新交易系统
        /// </summary>
        NewZLhq,
        /// <summary>
        /// 管理信息系统
        /// </summary>
        OldZlhq,
        /// <summary>
        /// 楼盘系统
        /// </summary>
        Zllp,
        /// <summary>
        /// 内网系统
        /// </summary>
        Zlnw,
        /// <summary>
        /// 深圳系统
        /// </summary>
        Zlsz,
        /// <summary>
        /// 长沙系统
        /// </summary>
        Zlcs,
        /// <summary>
        /// 武汉系统
        /// </summary>
        Zlwh,
        /// <summary>
        /// 广州系统
        /// </summary>
        Zlgz,
        /// <summary>
        /// 报表数据库
        /// </summary>
        ZLReport,
        /// <summary>
        /// 金蝶数据库
        /// </summary>
        ZLDCHR,
        /// <summary>
        /// 行政资产数据库
        /// </summary>
        ZlAsset
    }

}
